<template>



    应收款 ：<input type="text" v-model="bb.price">
    实收款 ：<input type="text" v-model="bb.sprice">

    <button @click="Show" class="btn btn-success">搜素</button>



    <table class="table table-bordered">

        <thead>

                <tr>
                    <th>编号</th>
                    <th>店名</th>
                    <th>客户信息</th>
                    <th>应收款</th>
                    <th>实际收款</th>
                    <th>现金</th>
                    <th>任意收款</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>

        </thead>


            <tbody v-for="item in aa">
                <tr>
                    <th>{{ item.sid }}</th>
                    <th>{{ item.shopName }}</th>
                    <th>{{ item.mnum     }}</th>
                    <th>{{ item.price }}</th>
                    <th>{{ item.sprice }}</th>
                    <th>{{ item.xianJin }}</th>
                    <th>{{ item.renYi?"支持":"不支持" }}</th>
                    <th>{{ item.static?"开业":"停业" }}</th>
                    <th><button @click="Xg(item.sid)">修改</button></th>
                </tr>

            </tbody>
    </table>



</template>


<script setup lang="ts">


import {onMounted, ref} from 'vue'
import axios from 'axios';

const aa=ref([{

    "sid": 0,
    "shopName": "string",
    "mnum": "string",
    "price": 0,
    "sprice": 0,
    "xianJin": "string",
    "renYi": true,
    "static": true




}])


const bb =ref({
    price:-1,
    sprice:-1,


})

onMounted(()=>{

    Show();
})



const Show=()=>{

    axios.get('https://localhost:7003/api/User/ShowShop',{params:{

        Price:bb.value.price,
        Sprice:bb.value.sprice,

    }}).then(res=>{

            aa.value=res.data;
    })

}


const Xg=(id:number)=>{

    axios.put('https://localhost:7003/api/User/UpDate?id='+id).then(res=>{

            if(res.data>0)
            {
                alert('修改成功')
                Show();
            }
            else if(res.data==-1)
            {
                alert('支持任意付款不能停业')
            }
            else
            {
                alert('修改失败')
            }
    })



}



</script>